package cn.sccl.common.scheduler.model;

import cn.sccl.common.exception.BusinessException;
import cn.sccl.common.model.BaseModel;

/**
* 定时调度任务日志表
* 数据库表 T_TASK_FIRE_LOG 的实体对象
* Created by _minus on 2017-10-08.
*/
public class TaskFireLog extends BaseModel{
   /**
   *表名
   */
   public final static String TABLE_NAME ="t_task_fire_log";

    private String groupName;//任务分组
    private String taskName;//任务名称
    private java.sql.Timestamp startTime;//任务开始时间
    private java.sql.Timestamp endTime;//结束时间
    private String status;//任务状态
    private String type;//任务分类
    private String serverHost;//主机
    private String fireInfo;//详细信息
    private String targetMethod;//任务方法
    private String targetObject;//任务对象
    private String targetParams;//任务参数

    public void setGroupName(String groupName){
        this.groupName = groupName;
    }

    public String getGroupName(){
        return this.groupName;
    }
    public void setTaskName(String taskName){
        this.taskName = taskName;
    }

    public String getTaskName(){
        return this.taskName;
    }
    public void setStartTime(java.sql.Timestamp startTime){
        this.startTime = startTime;
    }

    public java.sql.Timestamp getStartTime(){
        return this.startTime;
    }
    public void setEndTime(java.sql.Timestamp endTime){
        this.endTime = endTime;
    }

    public java.sql.Timestamp getEndTime(){
        return this.endTime;
    }
    public void setStatus(String status){
        this.status = status;
    }

    public String getStatus(){
        return this.status;
    }
    public void setType(String type){
        this.type = type;
    }

    public String getType(){
        return this.type;
    }
    public void setServerHost(String serverHost){
        this.serverHost = serverHost;
    }

    public String getServerHost(){
        return this.serverHost;
    }
    public void setFireInfo(String fireInfo){
        this.fireInfo = fireInfo;
    }

    public String getFireInfo(){
        return this.fireInfo;
    }
    public void setTargetMethod(String targetMethod){
        this.targetMethod = targetMethod;
    }

    public String getTargetMethod(){
        return this.targetMethod;
    }
    public void setTargetObject(String targetObject){
        this.targetObject = targetObject;
    }

    public String getTargetObject(){
        return this.targetObject;
    }
    public void setTargetParams(String targetParams){
        this.targetParams = targetParams;
    }

    public String getTargetParams(){
        return this.targetParams;
    }

    /**
    * clone一个对象。
    * @param cls 需要克隆的对象类型，只能是当前类的子类
    * @param <T>
    * @return
    * @throws IllegalAccessException
    * @throws InstantiationException
    */
    public <T extends TaskFireLog> T clone(Class<T> cls) {
       try {
          T t = cls.newInstance();
          t.setId(this.getId());
          t.setDeleteFlag(this.isDeleteFlag());
          t.setCreateTime(this.getCreateTime());
          t.setUpdateTime(this.getUpdateTime());
          /*t.setPosition(this.getPosition());
          t.setUpdateUser(this.getUpdateUser());
          t.setCreateUser(this.getCreateUser());*/
          t.setGroupName(this.getGroupName());
          t.setTaskName(this.getTaskName());
          t.setStartTime(this.getStartTime());
          t.setEndTime(this.getEndTime());
          t.setStatus(this.getStatus());
          t.setType(this.getType());
          t.setServerHost(this.getServerHost());
          t.setFireInfo(this.getFireInfo());
          t.setTargetMethod(this.getTargetMethod());
          t.setTargetObject(this.getTargetObject());
          t.setTargetParams(this.getTargetParams());
          return t;
       } catch (Exception e) {
          e.printStackTrace();
          throw new BusinessException("对象克隆失败，请克隆的目标对象是否具有无参的构造函数。", e.getCause());
       }
    }
}